<?php

namespace App\Service\Message\v1_2_2;

use App\Model\CloseFriend;
use App\Model\UserProfile;
use App\Service\BaseService;

/**
 * 亲密度详情
 */
class CloseDetailService extends BaseService
{
    protected function RoVerifyList()
    {
        return [
            'chat_user_id' => 'required|int'
        ];
    }

    public function handle()
    {
        $chatUserId = $this->request->input('chat_user_id', 0);
        $closeValue = CloseFriend::getCloseValue($this->userId, $chatUserId);
        $offsetInfo = CloseFriend::getOffset($closeValue);
        $chatProfile = UserProfile::getProfile($chatUserId);
        return [
            'user_info' => [
                'user_id' => $chatUserId,
                'nick_name' => $chatProfile->nick_name,
                'avatar' => $chatProfile->avatar,
            ],
            'close_value' => strval($closeValue),
            'off_close_value' => strval($offsetInfo['offset_value']),
            'close_value_next' => strval($offsetInfo['close_value_max']),
            'level' => $offsetInfo['level_min_title'],
            'level_next' => $offsetInfo['level_max_title'],
            'rule' => '每为对方消耗100金币，亲密值增加1°C;双方一天没有互动来往，则减0.1°C',
            'detail' => CloseFriend::getSetting(),
        ];
    }
}
